package com.aquila.datacontrol;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

import android.app.Activity;

import com.aquila.datacontrol.database.BaseDataSqlite;
import com.aquila.datacontrol.database.BibleReadSqlite;
import com.aquila.datacontrol.database.CNBaseDataSqlite;
import com.aquila.datacontrol.database.EveryLxBaseDataSqlite;
import com.aquila.datacontrol.database.LXBaseDataSqlite;
import com.aquila.datacontrol.database.MyBaseDataSqlite;
import com.aquila.datacontrol.database.NIVBaseDataSqlite;
import com.aquila.datacontrol.database.NewBaseDataSqlite;
import com.aquila.datacontrol.database.OtherDataSqlite;
import com.aquila.datacontrol.object.BelongObject;
import com.aquila.datacontrol.object.BibleObject;
import com.aquila.datacontrol.object.CNBibleObject;
import com.aquila.datacontrol.object.LXBibleObject;
import com.aquila.datacontrol.object.NIVBibleObject;
import com.aquila.datacontrol.object.NewBibleObject;

public class SaveDataToSqlite {
	Activity baseActivity ;
	
	public SaveDataToSqlite(Activity baseActivity) {
		this.baseActivity = baseActivity ;
	}
	private int cc ;
	
	
	public void testAsset(){
		String str = TextReader.readFromTxtFile(baseActivity, "cnbible/01_1.txt") ;
		System.out.println(str);
		
		
	}
	
	/**
	 * 方法入口
	 * void
	 * 2012-11-14 上午9:53:57
	 */
	public void methodIn(){
//		saveCNDataToSql() ;
//		saveMyDataToSql() ;
//		saveLXDataToSql() ;
		updateSqliteToNew() ;
//		saveEveryDayDataToSql() ;
	}
	
	
	/**
	 * 更新数据库新的结构
	 *Administrator
	 *2013-3-14 下午9:40:32
	 */
	private void updateSqliteToNew(){
		BaseDataSqlite baseDataSqlite = new BaseDataSqlite(baseActivity) ;
		baseDataSqlite.open() ;
		
		MyBaseDataSqlite myBaseDataSqlite = new MyBaseDataSqlite(baseActivity) ;
		myBaseDataSqlite.open() ;
		
		int count = baseDataSqlite.getDataCount();
		int index = 0 ;
		int flag = 0 ;
		for (int i = 1; i <= count; i++) {
			BibleObject bibleObject = baseDataSqlite.getEveryData(i) ;
			if (bibleObject.getBookIndex() * 1000 + bibleObject.getChapterIndex() > flag) {
            	flag = bibleObject.getBookIndex() * 1000 + bibleObject.getChapterIndex() ;
            	index ++ ;
            }
			else {
				System.err.println("未执行更新");
			}
			bibleObject.setChapterIndexInBook(index) ;
			myBaseDataSqlite.insertData(bibleObject) ;
			System.out.println(bibleObject.getId() +"、" +bibleObject.getShortBookName() +
					" " +bibleObject.getChapterIndex() +":"+bibleObject.getSectionIndex()+"，总索引为："+bibleObject.getChapterIndexInBook());
			
        }
		myBaseDataSqlite.close() ;
		baseDataSqlite.close() ;
	}
	
	
	
	
	
	int count = 0 ;
	/**
	 * 保存数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveEveryDayDataToSql(){
		EveryLxBaseDataSqlite dataSqlite = new EveryLxBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;
		
		BelongObject belongObject ;
//		OtherObject otherObject ;
		LXBibleObject object = new LXBibleObject() ;
		int hasxulun = 0 ;
		int chapterCount = 0 ;
//		for (int i = 2; i < 3; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
		belongObject = belongDataSqlite.getBelongObject(i+1) ;
		chapterCount = 0 ;
		if (TextReader.hasXulun(baseActivity, i+1)) {
        	hasxulun = 1 ;
        }else {
			hasxulun = 0 ;
		}
		
		for (int j = 0; j <= belongObject.getChapterCount(); j++) {
			if (TextReader.isChapterexist(baseActivity, i+1, j)) {
        		chapterCount++ ;
        	}
        }
		
		
		for (int j = 0,len = belongObject.getChapterCount(); j <= len; j++) { // 章节
//			for (int j = 0; j < 2; j++) { // 测试章节
		if (!TextReader.isChapterexist(baseActivity, i+1, j)) {
			continue ;
		}
		String chapterString = TextReader.readEveryLXChapter(baseActivity, i+1, j) ;
		
		object.setBookIndex(belongObject.getBookID()) ;
		object.setBookName(belongObject.getName()) ;
//		object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
//		object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
		object.setChapterCount(chapterCount) ;
		object.setBelongTo(getBelong(i)) ;
		object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
		if (i < 39) {
		object.setIsNew(0) ;
		}else {
		object.setIsNew(1) ;
		}
		object.setChapterIndex(j) ;
		object.setContentText(chapterString) ;
		object.setHasXuLun(hasxulun) ;
		dataSqlite.insertData(object) ;
		cc++ ;
		System.out.println(cc + "、"+object.getBookName()+
				object.getChapterIndex()+"  "+"["+object.getBelongTo()+"] 章书为：" +chapterCount);
		
		}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	
	
	public void readTitle(){
		BibleReadSqlite bibleReadSqlite =new BibleReadSqlite(baseActivity) ;
		bibleReadSqlite.open() ;
		String string = bibleReadSqlite.readTitle() ;
		bibleReadSqlite.close() ;
//		System.out.println(string);
	}
	
	
	/**
	 * 保存中英文的数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveMyDataToSql(){
		int sectionIndex = 0 ;
		int sectionCount = 0 ;
		CNBaseDataSqlite dataSqlite = new CNBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;

		BelongObject belongObject ;
//		OtherObject otherObject ;
		CNBibleObject object = new CNBibleObject() ;
//		for (int i = 18; i < 19; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
			belongObject = belongDataSqlite.getBelongObject(i+1) ;
			for (int j = 0,len = belongObject.getChapterCount(); j < len; j++) { // 章节
//			for (int j = 0; j < 5; j++) { // 测试章节
				String chapterString = TextReader.readAndChapter(baseActivity, i+1, j+1) ;
				String[] sections = chapterString.split("\n") ;
				String enString = TextReader.readNIVChapter(baseActivity, i+1, j+1) ;
				String[] enSections = enString.split("\n") ;
				sectionIndex = 0 ;
				sectionCount = getSectionCount(sections) ;
				for (int k = 0, length = sections.length; k < length; k++) { //经文
						object.setBookIndex(belongObject.getBookID()) ;
						object.setBookName(belongObject.getName()) ;
						object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
						object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
						object.setChapterCount(belongObject.getChapterCount()) ;
						object.setBelongTo(getBelong(i)) ;
						object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
						if (i < 39) {
						object.setIsNew(0) ;
						}else {
						object.setIsNew(1) ;
						}
						object.setChapterIndex(j+1) ;
						
						object.setSectionCount(sectionCount) ;
						object.setSectionId(k+1) ;
						
						if (sections[k] .contains("@")) {
		                	sections[k] = sections[k].replace("@", "") ;
		                	object.setSectionText(sections[k]) ;
		                	object.setEnSectionText("") ;
		                	object.setIsTitle(1) ;
		                	object.setSectionIndex(0) ;
						}else if (sections[k].contains("#")) {
			                sections[k] = sections[k].replace("#", "") ;
			                object.setSectionText(sections[k]) ;
			                object.setIsTitle(2) ;
			                object.setEnSectionText("") ;
			                object.setSectionIndex(0) ;
			                
						}else {
						if (sections[k].length() < 3) {
							continue ;
						}
						matcher = pattern.matcher(sections[k]) ;
						if (matcher.find()) {
							sectionIndex++ ;
							sections[k] = sections[k].replace(matcher.group(), "") ;
						}else {
							System.out.println("返回");
//							System.out.println(cc + "、"+object.getBookName()+
//							object.getChapterIndex()+":"+object.getSectionIndex()+"["+object.getBelongTo()+"]" +sections[k]);
							return ;
//							continue ;
						}
							//设置英文
						object.setIsTitle(0) ;
						object.setEnSectionText(dealString(enSections[sectionIndex-1])) ;
						object.setSectionText(sections[k]) ;
						object.setSectionIndex(sectionIndex) ;
						
						}
						dataSqlite.insertData(object) ;
						cc++ ;
						System.out.println(cc + "、"+object.getBookName()+
								object.getChapterIndex()+":"+object.getSectionIndex()+"["+object.getBelongTo()+"]" + object.getSectionText());
						
	            } //结束经节的循环
			}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	
	
	
	
	
	/**
	 * 保存数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveDataToSql(){
		int sectionIndex = 0 ;
		int sectionCount = 0 ;
		NewBaseDataSqlite dataSqlite = new NewBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;

		BelongObject belongObject ;
//		OtherObject otherObject ;
		NewBibleObject object = new NewBibleObject() ;
//		for (int i = 18; i < 19; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
			belongObject = belongDataSqlite.getBelongObject(i+1) ;
			for (int j = 0,len = belongObject.getChapterCount(); j < len; j++) { // 章节
//			for (int j = 0; j < 5; j++) { // 测试章节
				String chapterString = TextReader.readChapter(baseActivity, i+1, j+1) ;
				String[] sections = chapterString.split("\n") ;
//				String enString = TextReader.readNIVChapter(baseActivity, i+1, j+1) ;
//				String[] enSections = enString.split("\n") ;
				
				sectionIndex = 0 ;
				sectionCount = getSectionCount(sections) ;
				for (int k = 0, length = sections.length; k < length; k++) { //经文
						object.setBookIndex(belongObject.getBookID()) ;
						object.setBookName(belongObject.getName()) ;
//						object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
//						object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
						
						object.setChapterCount(belongObject.getChapterCount()) ;
						object.setBelongTo(getBelong(i)) ;
						object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
						if (i < 39) {
						object.setIsNew(0) ;
						}else {
						object.setIsNew(1) ;
						}
						object.setChapterIndex(j+1) ;
						
						object.setSectionCount(sectionCount) ;
						object.setSectionId(k+1) ;
						
						if (sections[k] .contains("@")) {
		                	sections[k] = sections[k].replace("@", "") ;
		                	object.setSectionText(sections[k]) ;
//		                	object.setEnSectionText("") ;
		                	object.setIsTitle(1) ;
		                	object.setSectionIndex(0) ;
						}else if (sections[k].contains("#")) {
			                sections[k] = sections[k].replace("#", "") ;
			                object.setSectionText(sections[k]) ;
			                object.setIsTitle(2) ;
//			                object.setEnSectionText("") ;
			                object.setSectionIndex(0) ;
			                
						}else {
						matcher = pattern.matcher(sections[k]) ;
						if (matcher.find()) {
							sectionIndex++ ;
							sections[k] = sections[k].replace(matcher.group(), "") ;
						}else {
							System.out.println("返回");
							return ;
						}
							//设置英文
						object.setIsTitle(0) ;
//						object.setEnSectionText(dealString(enSections[sectionIndex-1])) ;
						object.setSectionText(sections[k]) ;
						object.setSectionIndex(sectionIndex) ;
						
						}
						dataSqlite.insertData(object) ;
						cc++ ;
						System.out.println(cc + "、"+object.getBookName()+
								object.getChapterIndex()+":"+object.getSectionIndex()+"["+object.getBelongTo()+"]" + object.getSectionText());
						
	            } //结束经节的循环
			}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	/**
	 * 保存数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveLXDataToSql(){
		LXBaseDataSqlite dataSqlite = new LXBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;
		
		BelongObject belongObject ;
//		OtherObject otherObject ;
		LXBibleObject object = new LXBibleObject() ;
//		for (int i = 2; i < 3; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
		belongObject = belongDataSqlite.getBelongObject(i+1) ;
		for (int j = 0,len = belongObject.getChapterCount(); j < len; j++) { // 章节
//			for (int j = 0; j < 5; j++) { // 测试章节
		String chapterString = TextReader.readLXChapter(baseActivity, i+1, j+1) ;
		object.setBookIndex(belongObject.getBookID()) ;
		object.setBookName(belongObject.getName()) ;
//		object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
//		object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
		object.setChapterCount(belongObject.getChapterCount()) ;
		object.setBelongTo(getBelong(i)) ;
		object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
		if (i < 39) {
		object.setIsNew(0) ;
		}else {
		object.setIsNew(1) ;
		}
		object.setChapterIndex(j+1) ;
		object.setContentText(chapterString) ;
		
		dataSqlite.insertData(object) ;
		cc++ ;
		System.out.println(cc + "、"+object.getBookName()+
				object.getChapterIndex()+"  "+"["+object.getBelongTo()+"]");
		
		}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	
	/**
	 * 保存英文数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveNIVDataToSql(){
		int sectionIndex = 0 ;
		int sectionCount = 0 ;
		NIVBaseDataSqlite dataSqlite = new NIVBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;
		
		BelongObject belongObject ;
//		OtherObject otherObject ;
		NIVBibleObject object = new NIVBibleObject() ;
//		for (int i = 0; i < 1; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
		belongObject = belongDataSqlite.getBelongObject(i+1) ;
		for (int j = 0,len = belongObject.getChapterCount(); j < len; j++) { // 章节
//			for (int j = 5; j < 9; j++) { // 测试章节
		String chapterString = TextReader.readNIVChapter(baseActivity, i+1, j+1) ;
		String[] sections = chapterString.split("\n") ;
		sectionIndex = 0 ;
		sectionCount = getSectionCount(sections) ;
		for (int k = 0, length = sections.length; k < length; k++) { //经文
		object.setBookIndex(belongObject.getBookID()) ;
		object.setBookName(belongObject.getName()) ;
		object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
		object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
		
		object.setChapterCount(belongObject.getChapterCount()) ;
		object.setBelongTo(getBelong(i)) ;
		object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
		if (i < 39) {
		object.setIsNew(0) ;
		}else {
		object.setIsNew(1) ;
		}
		object.setChapterIndex(j+1) ;
		
		object.setSectionCount(sectionCount) ;
		object.setSectionId(k+1) ;
		
		if (sections[k] .contains("@")) {
		sections[k] = sections[k].replace("@", "") ;
		object.setSectionText(sections[k]) ;
		object.setEnSectionText("") ;
		object.setIsTitle(1) ;
		object.setSectionIndex(0) ;
		}else if (sections[k].contains("#")) {
		sections[k] = sections[k].replace("#", "") ;
		object.setSectionText(sections[k]) ;
		object.setIsTitle(2) ;
		object.setEnSectionText("") ;
		object.setSectionIndex(0) ;
		
		}else {
		matcher = pattern.matcher(sections[k]) ;
		if (matcher.find()) {
			sectionIndex++ ;
		}
		//设置英文
		object.setIsTitle(0) ;
		object.setEnSectionText(dealString(sections[k])) ;
		object.setSectionText("") ;
		object.setSectionIndex(sectionIndex) ;
		
		}
		dataSqlite.insertData(object) ;
		cc++ ;
		System.out.println(cc + "、"+object.getBookName()+
				object.getChapterIndex()+":"+object.getSectionIndex()+"["+object.getBelongTo()+"]");
		
		} //结束经节的循环
		}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	
	
	/**
	 * 保存英文数据到数据库
	 * void
	 * 2012-11-6 下午3:39:48
	 */
	public void saveCNDataToSql(){
		int sectionIndex = 0 ;
		int sectionCount = 0 ;
		CNBaseDataSqlite dataSqlite = new CNBaseDataSqlite(baseActivity) ;
		dataSqlite.open() ;
		
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		
		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
		otherDataSqlite.open() ;
		
		BelongObject belongObject ;
//		OtherObject otherObject ;
		CNBibleObject object = new CNBibleObject() ;
//		for (int i = 18; i < 19; i++) { //书卷
		for (int i = 0; i < 66; i++) { //书卷
		belongObject = belongDataSqlite.getBelongObject(i+1) ;
		for (int j = 0,len = belongObject.getChapterCount(); j < len; j++) { // 章节
//		for (int j = 117; j < 120; j++) { // 测试章节
		String chapterString = TextReader.readCNChapter(baseActivity, i+1, j+1) ;
		String[] sections = chapterString.split("\n") ;
		sectionIndex = 0 ;
		sectionCount = getSectionCount(sections) ;
		for (int k = 0, length = sections.length; k < length; k++) { //经文
		object.setBookIndex(belongObject.getBookID()) ;
		object.setBookName(belongObject.getName()) ;
		object.setEnBookName(SystemConfig.en_testamentNameStrings[i]) ;
		object.setEnShortBookName(SystemConfig.en_testamentShortStrings[i]) ;
		
		object.setChapterCount(belongObject.getChapterCount()) ;
		object.setBelongTo(getBelong(i)) ;
		object.setShortBookName(SystemConfig.testamentShortStrings[i]) ;
		if (i < 39) {
		object.setIsNew(0) ;
		}else {
		object.setIsNew(1) ;
		}
		object.setChapterIndex(j+1) ;
		
		object.setSectionCount(sectionCount) ;
		object.setSectionId(k+1) ;
		
		if (sections[k] .contains("@")) {
		sections[k] = sections[k].replace("@", "") ;
		object.setSectionText(sections[k]) ;
		object.setEnSectionText("") ;
		object.setIsTitle(1) ;
		object.setSectionIndex(0) ;
		}else if (sections[k].contains("#")) {
		sections[k] = sections[k].replace("#", "") ;
		object.setSectionText(sections[k]) ;
		object.setIsTitle(2) ;
		object.setEnSectionText("") ;
		object.setSectionIndex(0) ;
		
		}else {
		matcher = pattern.matcher(sections[k]) ;
		if (matcher.find()) {
			sectionIndex++ ;
		}
		//设置英文
		object.setIsTitle(0) ;
		object.setEnSectionText("") ;
		object.setSectionText(dealString(sections[k])) ;
		object.setSectionIndex(sectionIndex) ;
		
		}
		dataSqlite.insertData(object) ;
		cc++ ;
		System.out.println(cc + "、"+object.getBookName()+
				object.getChapterIndex()+":"+object.getSectionIndex()+"["+object.getBelongTo()+"]");
		
		} //结束经节的循环
		}//结束章节的循环
		}//结束书卷的循环
		belongDataSqlite.close() ;
		otherDataSqlite.close() ;
		dataSqlite.close() ;
	}
	
	private String getBelong(int index){
		if (index<5) {
        	return SystemConfig.belongStrings[0] ;
        }
		else if (index < 17) {
		return SystemConfig.belongStrings[1] ;
        
        }
		else if (index < 22) {
		return SystemConfig.belongStrings[2] ;
		
		}
		else if (index < 27) {
		return SystemConfig.belongStrings[3] ;
		
		}
		else if (index < 39) {
		return SystemConfig.belongStrings[4] ;
		
		}
		else if (index < 43) {
		return SystemConfig.belongStrings[5] ;
		
		}
		else if (index == 43) {
		
		return SystemConfig.belongStrings[6] ;
		}
		else if (index < 57) {
		
		return SystemConfig.belongStrings[7] ;
		}
		else if (index < 65) {
		return SystemConfig.belongStrings[8] ;
		}
		else if (index == 65) {
		return SystemConfig.belongStrings[9] ;
		}
		return "";
	}
	
	
	private Pattern pattern  = Pattern.compile(SystemConfig.regex+"\\s*") ;
//	private Pattern pattern  = Pattern.compile("\\s*[0-9]*\\s*") ;
	private Matcher matcher  ;
	private String dealString(String temp){
		matcher = pattern.matcher(temp) ;
		String val = null ;
		if (matcher.find()) {
			val = matcher.group() ;
		}else {
        	return "&"+temp ;
        }
		temp = temp.replace(val, "") ;
		while(temp.startsWith(" ")){
			temp = temp.substring(1) ;
		}
//		temp = temp.substring(1) ; //去掉首页的空格
		return  temp;
	}
	
	private int getSectionCount(String[] secs){
		int count = 0 ;
		for (int i = 0, len = secs.length; i < len; i++) {
			if (secs[i].contains("#") || secs[i].contains("@") || secs[i].length() == 0) {
				continue ;
			}
			matcher = pattern.matcher(secs[i]) ;
			if (!matcher.find()) {
            	continue ;
            }
			count++ ;
		}
		return count ;
		
	}
		
		
	
	
	
	
	public void testControl(){
//		OtherDataSqlite otherDataSqlite = new OtherDataSqlite(baseActivity) ;
//		otherDataSqlite.open() ;
		BelongDataSqlite belongDataSqlite = new BelongDataSqlite(baseActivity) ;
		belongDataSqlite.open() ;
		for (int i = 0; i < 66; i++) {
			BelongObject object = belongDataSqlite.getBelongObject(i+1) ;
			System.out.println(object.getBookID()+"、"+object.getName()+"("+object.getEnName() +") "
					+object.getTag());
        }
		belongDataSqlite.close() ;
		
//		for (int i = 1; i < 2; i++) {
//			for (int j = 1; j < 5; j++) {
//				for (int k = 1; k < 5; k++) {
//					OtherObject object= otherDataSqlite.getEnContent(i, j, k) ;
//					System.out.println(object.getBookName()+
//							object.getParagraphNumber()+"、"+object.getEnContent());
//					
//					
//				}
//			}
//		}
//		otherDataSqlite.close() ;
		
	}
	
}
